package cn.stronglink.asset.terminal.bjc.transfer.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.stronglink.asset.model.Transfer;
import cn.stronglink.asset.terminal.bjc.transfer.service.TransferApiService;
import cn.stronglink.asset.terminal.bjc.transfer.vo.TransferApiVo;
import cn.stronglink.suite.core.base.AbstractController;

@Controller
@RequestMapping(value = "/bjc/transferApi")
public class TransferApiController extends AbstractController{
	
	@Autowired
	private TransferApiService transferApiService;
	
	/**
	 * 查询列表
	 * @param modelMap
	 * @param request
	 * @param response
	 * @param params
	 * @return
	 */
	@RequestMapping(value = "qryTransferList")
	public ResponseEntity<ModelMap> qryTransferList(ModelMap modelMap, HttpServletRequest request,
			HttpServletResponse response,@RequestBody Map<String,Object> params) {	
		List<TransferApiVo> list = transferApiService.qryTransferList(params);
		return setSuccessModelMap(modelMap, list);
	}	
	
	/**
	 * 手持端  上传结果
	 * @param modelMap
	 * @param request
	 * @param response
	 * @param params
	 * @return
	 */
	@RequestMapping(value = "uploadTransfer")
	public ResponseEntity<ModelMap> uploadTransfer(ModelMap modelMap, HttpServletRequest request,
			HttpServletResponse response,@RequestBody Transfer transfer) {	
		if(transfer!=null) {
			transferApiService.createTransfer(transfer);
		}
		return setSuccessModelMap(modelMap, null);
	}	
}
